pp108 : Design-time Library for Hyperlink Composite Control

Design-time Library for Hyperlink Composite Control

This topic provides the design-time library that is used to create the Hyperlink composite control.


You need to create the design-time library for the Hyperlink composite control to define its design-time behavior. Use the following code to create the design-time library for theHyperlinkcomposite control.

<html onapplicationready="">
    <head>
        <script type="text/javascript">
setPublic(Hyperlink, "designtimeLibrary");

importType("cas.xforms.designerlibrary.controls.XFormsGroupControl");
inherit(Hyperlink, XFormsGroupControl);
Hyperlink.icon = "/cordys/wcp/theme/default/icon/document/compositecontrol.png";

// This is the constructor of the composite control
// It calls the base class's constructor

function Hyperlink(designerView)
{
	this.XFormsControl(designerView);
}
Hyperlink.prototype.onAfterCreate = function()
{
	createLinkElement(this);
}

function createLinkElement(hyperlink)
{
	// hide the default icon
	hyperlink.hideIcon();
	// create the link element inside the groupbox
	var container = hyperlink.getChildContainer();
	linkElement = container.ownerDocument.createElement("a");
	// set the text to be displayed
	linkElement.innerText = "hyperlink";
	// set style
	linkElement.style.textDecoration = "underline";
	container.appendChild(linkElement);
	return linkElement;
}

//Update the hyperlink control according to the value specified for the text property
//the parameter hyperlink denotes the instance of the Hyperlink control
//sText is the value specified for the text property in the property sheet
Hyperlink.prototype.updateText = function(hyperlink, sText)
{
	var linkElement = hyperlink.control.getChildContainer().firstChild;
	linkElement.innerText = sText;
}

</script>
    </head>
    <body/>
</html>


After defining a design-time library for the Hyperlink composite control, you will need to create a run-time library for it that defines its run-time behavior.

Related reference

Run-time Library for Hyperlink Composite Control